//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 20/03/2010
//-----------------------------------------------------------------------------
#ifndef COLLIDEREGIONS_H
#define COLLIDEREGIONS_H

#include "collidable.h"
#include "rectangle.h"

#include <list>
#include <vector>
#include <map>
using namespace std;

namespace bend2d
{
    class Collidable;
    class World;
	
    class CollideRegion
	{
	public:
        typedef map<Point, CollideRegion> CollideRegionMap;

        void AddColliableObject(Collidable* object);
        const list<Collidable*>& GetObjects() const;
        list<Collidable*>& GetObjects();
        void SetRegionRect(const Rectangle& rect);
        const Rectangle& GetRegionRect() const;

    private:
		list<Collidable*> m_CollidableObjects;
        map<Collidable*, bool> m_AddedObjects;
        Rectangle m_RegionRect;
	};

	class CollideRegions
	{
    public:
        void SetWorld(World* world);
        void Reset();
        void RecreateRegions(list<Collidable*>& regions);
    private:
        World *m_World;
        list<pair<Collidable*, Collidable*> > m_WillCollide;

	};
}

#endif
